<?php
/**
 * Created by PhpStorm.
 * Author: ExtraXue
 * Date: 2018/5/9
 * Description:
 */

session_start();


require_once ('pdo.php');
$newName=$_GET['newName'];
$newNumber=$_GET['newNumber'];
$newDept=$_GET['newDept'];

$keyWord=$_SESSION['keyWord'];

if($newName){
    $sqlUserChangeName="update user_info set username = '{$newName}' where number='{$keyWord}'";
    $pdo->exec($sqlUserChangeName);
    echo '<script>alert("用户名称修改成功！");location.href="relDeptUserChange.php";</script>';
}
if($newNumber){
    $sqlUserChangeNumber="update user_info set number = '{$newNumber}' where number='{$keyWord}'";
    $pdo->exec($sqlUserChangeNumber);
    echo '<script>alert("用户学号/工号修改成功！");location.href="relDeptUserChange.php";</script>';
}
if($newDept){
    $sqlUserChangeNumber="update user_info set dept_id = '{$newDept}' where number='{$keyWord}'";
    $pdo->exec($sqlUserChangeNumber);
    echo '<script>alert("用户党支部修改成功！");location.href="relDeptUserChange.php";</script>';
}